/**
 * Created on [2021/1/22 20:15] by 刘金龙
 * <p>
 * 项目名称: orion
 * <p>
 * 本程序版权属于福建慧政通信息科技有限公司所有。
 * 任何组织和个人未经福建慧政通信息科技有限公司许可与授权,不得擅自传播、复制、更改该程序的内容。
 * 本程序受版权法和国际条约的保护。如未经授权而擅自复制或传播本程序(或其中任何部分),
 * 将受到严厉的刑事及民事制裁，并将在法律许可的范围内受到最大可能的起诉!
 * <p>
 * ©2021 福建慧政通信息科技有限公司
 */
package com.sunnada.btfvilg.common.exception;

import com.sunnada.btfvilg.common.response.ResponseStatusCode;

/**
 * 服务异常
 *
 * @author 刘金龙
 * @since 2021/1/22
 */
public class ServiceException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    private final ResponseStatusCode responseStatusCode;

    public ServiceException(String message) {
        super(message);
        this.responseStatusCode = ResponseStatusCode.FAILED;
    }

    public ServiceException(ResponseStatusCode responseStatusCode) {
        super(responseStatusCode.getMessage());
        this.responseStatusCode = responseStatusCode;
    }

    public ServiceException(ResponseStatusCode responseStatusCode, String message) {
        super(message);
        this.responseStatusCode = responseStatusCode;
    }

    public ServiceException(String message, Throwable cause) {
        super(message, cause);
        this.responseStatusCode = ResponseStatusCode.FAILED;
    }

    public ResponseStatusCode getResponseStatusCode() {
        return responseStatusCode;
    }
}